#pragma once

#include "../../../../../C/Alloc.h"

namespace FileManager
{
	class CMyBuffer
	{
		void* _data;
	public:
		CMyBuffer() : _data(0) {}
		operator void* ()
		{
			return _data;
		}
		bool Allocate(size_t size)
		{
			if (_data != 0)
			{
				return false;
			}
			_data = ::MidAlloc(size);
			return _data != 0;
		}
		~CMyBuffer()
		{
			::MidFree(_data);
		}
	};

} //namespace FileManager